<template>
  <BaseForm
    labelWidth="160px"
    :inline="true"
    :fromIems="fromIems"
    ref="BaseForm"
    @submit="handleSubmit"
    @edit="edit"
  ></BaseForm>
</template>

<script>
import tableMixin from "@/mixins";
export default {
  mixins: [tableMixin],
  components: {},
  data() {
    return {
      fromIems: [
        {
          valueType: "input",
          label: "订单号",
          dataIndex: "currencyName",
          default: null,
          rules: [{ required: true, message: "请输入", trigger: "blur" }],
        },
      ],
    };
  },
  mounted() {
    // api 拿表单属性
    let attr = [
      {
        title: "功率",
        valueType: "input",
        dataIndex: "gl",
        default: 1,
        required: true,
      },
      {
        title: "服务费",
        valueType: "input",
        dataIndex: "fw",
        default: 2,
        required: true,
      },
      {
        title: "尺寸",
        valueType: "input",
        dataIndex: "cc",
        default: 3,
        required: true,
      },
      {
        title: "频率",
        valueType: "input",
        dataIndex: "pl",
        required: false,
        default: 4,
      },
    ];
    attr.forEach((el) => {
      this.fromIems.push({
        valueType: "input",
        label: el.title,
        dataIndex: el.dataIndex,
        default: el.default,
        rules: [{ required: el.required, message: "请输入", trigger: "blur" }],
      });
      if(el.default){
        this.$set(this.$refs.BaseForm.form,el.dataIndex,el.default)
      }
    });
  },
  methods: {
    submit() {
      this.$refs.BaseForm.submit()
    },
    handleSubmit(data){
      console.log(data)
    },
    edit() {},
  },
};
</script>
